// Copyright (C) 2005 Taylor L. Riche <riche@cs.utexas.edu>
//  
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// $Id: packet.hh 68 2005-08-02 15:17:06Z  $
//
// -----------------------------------------------------------------

#ifndef PACKET_H
#define PACKET_H

#include <netinet/ip.h>
#include <netinet/tcp.h>

#ifdef TT_BUILD
#include "fivetuple.hh"
#else
#include <tracetools/fivetuple.hh>
#endif

namespace tt {

const uint32_t BITMASK = 0xffffffff;

#ifndef uint64_t
typedef unsigned long long uint64_t;
#endif

struct Packet
{
  uint32_t tsSec;
  uint32_t tsUSec;
  iphdr ipHdr;
  tcphdr tcpHdr;
  
  uint32_t getTimestamp() const
  {
    uint64_t longstamp = (tsSec * 1000000) + tsUSec;
    return (longstamp & BITMASK);
  }
  const FiveTuple getFiveTuple() const;
};
}
#endif // PACKET_H
